package com.sx.form.biz.impl;

import java.util.ArrayList;
import java.util.List;

import com.sx.form.biz.ITitleBiz;
import com.sx.form.dao.ITitleDao;
import com.sx.form.entity.TitleEntity;

/**
 * @author Administrator
 * 业务层代码实现类
 */
public class TitleBiz implements ITitleBiz {
	private ITitleDao ititledao;

	/* (non-Javadoc)
	 * @see com.demo.biz.ITitleBiz#findTitlesByPaging(com.demo.entity.TitleEntity)
	 */
	public List<TitleEntity> findTitlesByPaging(TitleEntity title)
			throws Exception {
		// TODO Auto-generated method stub
		List<TitleEntity> list = new ArrayList<TitleEntity>();
		try {
			list = this.ititledao.findTitlesByPaging(title);
		} catch (Exception e) {
			e.printStackTrace();
			throw new Exception(e);
			// TODO: handle exception
		} 
		return list;
	}

	/* (non-Javadoc)
	 * @see com.demo.biz.ITitleBiz#addTitle(com.demo.entity.TitleEntity)
	 */
	public Integer addTitle(TitleEntity title) throws Exception {
		// TODO Auto-generated method stub
		try {
			return ititledao.addTitle(title);
		} catch (Exception e) {
			throw new Exception();
			// TODO: handle exception
		}
	}

	/* (non-Javadoc)
	 * @see com.demo.biz.ITitleBiz#deleteTitle(com.demo.entity.TitleEntity)
	 */
	public boolean deleteTitle(TitleEntity title) throws Exception {
		// TODO Auto-generated method stub
		try {
			return ititledao.deleteTitle(title);
		} catch (Exception e) {
			e.printStackTrace();
			throw new Exception(e);
			// TODO: handle exception
		}
	}

	/* (non-Javadoc)
	 * @see com.demo.biz.ITitleBiz#findTitles(com.demo.entity.TitleEntity)
	 */
	public List<TitleEntity> findTitles(TitleEntity title) throws Exception {
		// TODO Auto-generated method stub
		List<TitleEntity> list = new ArrayList<TitleEntity>();
		try {
			list = this.ititledao.findTitles(title);
		} catch (Exception e) {
			throw new Exception(e);
			// TODO: handle exception
		} 
		return list;
	}

	/* (non-Javadoc)
	 * @see com.demo.biz.ITitleBiz#updateTitle(com.demo.entity.TitleEntity)
	 */
	public boolean updateTitle(TitleEntity title) throws Exception {
		// TODO Auto-generated method stub
		try {
			return ititledao.updateTitle(title);
		} catch (Exception e) {
			throw new Exception();
			// TODO: handle exception
		}
	}

	/**
	 * @return the ititledao
	 */
	public ITitleDao getItitledao() {
		return ititledao;
	}

	/**
	 * @param ititledao the ititledao to set
	 */
	public void setItitledao(ITitleDao ititledao) {
		this.ititledao = ititledao;
	}
	
}
